<template>
  <div class="goods">
    <head-nav :cname="titleName"></head-nav>
    <search-l @click="handleClick">
      <template>
        <el-input
          class="i-css"
          placeholder="请输入内容"
          prefix-icon="el-icon-search"
          v-model="input"
        >
        </el-input>
      </template>
    </search-l>
    <data-list>
      <template>
        <span class="add" onselectstart="return false" @click="addHd"
          >添加</span
        >
      </template>
    </data-list>
    <el-table :data="idData" border style="text-align:center">
      <el-table-column prop="id" label="编号" width="100"> </el-table-column>
      <el-table-column prop="goodsName" label="商品名称"> </el-table-column>
      <el-table-column prop="goodsCode" label="货号" width="100">
      </el-table-column>
      <el-table-column prop="price" label="商品价格" width="100">
      </el-table-column>
      <el-table-column label="秒杀价格" width="100">
        <template>
          <el-input></el-input>
        </template>
      </el-table-column>
      <el-table-column label="秒杀数量" width="100">
        <template>
          <el-input></el-input>
        </template> </el-table-column
      ><el-table-column prop="count" label="剩余数量" width="100">
      </el-table-column
      ><el-table-column label="限购数量" width="100">
        <template>
          <el-input></el-input>
        </template> </el-table-column
      ><el-table-column label="排序" width="100">
        <template>
          <el-input></el-input>
        </template>
      </el-table-column>
      <el-table-column width="50" label="操作">
        <template slot-scope="scope">
          <a href="javascript:;" @click="del(scope.row)">删除</a>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="params.currentPage"
      :page-sizes="[2, 4, 8, 16]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      titleName: this.$route.query.name,
      idData: [],
      params: {
        currentPage: 1,
        queryString: ''
      },
      total: 0,
      input: ''
    }
  },
  methods: {
    async handleClick(e) {
      console.log(this.input)
      const a = await this.$http.post('/ActiveController/findaddGoodsBack', {
        pagination: this.params
      })
      console.log(a, 'aaads')
    },
    handleSizeChange(val) {
      console.log(val, 'handlesizechange.....')
    },
    handleCurrentChange(val) {
      console.log(val, 'handleCurrentChange.....')
    },
    addHd() {
      console.log('添加')
    },
    // 删除
    del(scp) {
      console.log('删除', scp)
    },
    async getGoodsLists() {
      const { data: res } = await this.$http.get(
        '/ActiveController/findGoods',
        {
          params: {
            activeId: parseInt(this.$route.query.activeId),
            activeTimeId: parseInt(this.$route.query.activeTimeId)
          }
        }
      )
      if (res.Flag !== true) {
        return this.$Toast('查询失败', 'error')
      }
      this.$Toast('查询成功', 'success')
      console.log(res, 'bbcd')
      this.idData = res.data
    }
  },
  created() {
    this.getGoodsLists()
  }
}
</script>

<style lang="less" scope>
.add {
  cursor: pointer;
  padding: 10px 20px;
  border: 1px solid rgba(228, 228, 228, 1);
  margin: 0 5px;
  background: #fff;
}
.add:hover {
  background: #f3f3f3;
}
</style>
